// 导入request
import request from '@/utils/request'

// 定义获取文章列表的服务
export const artGetChannelsService = () => request.get('/my/cate/list')

// 添加文章分类, data为分类信息
export const artAddChannelService = (data) => request.post('/my/cate/add', data)

// 编辑文章分类, data为分类信息
export const artEditChannelService = (data) =>
  request.put('/my/cate/info', data)

// 删除文章分类, id为分类id
// delete写法介绍: 需要搭配params参数
export const artDelChannelService = (id) =>
  request.delete('/my/cate/del', {
    params: { id }
  })

// 获取文章列表, params为查询参数
export const artGetListService = (params) =>
  request.get('/my/article/list', { params })

// 添加文章, data为文章信息
export const artPublishService = (data) => request.post('/my/article/add', data)

// 获取文章详情, id为文章id
export const artGetDetailService = (id) =>
  request.get('my/article/info', { params: { id } })

// 编辑文章, data为文章信息
export const artEditService = (data) => request.put('my/article/info', data)

// 删除文章, id为文章id
export const artDelService = (id) =>
  request.delete('my/article/info', { params: { id } })
